package action;

import java.awt.Color;
import org.netbeans.api.visual.action.TwoStateHoverProvider;
import org.netbeans.api.visual.widget.Widget;

/**
 * @author Slompo
 */
public class HoverColor implements TwoStateHoverProvider {

    private Color color;
    
    public HoverColor() {
        this(new Color(52, 124, 150));
    }

    public HoverColor(Color color) {
        this.color = color;
    }
    
    @Override
    public void unsetHovering(Widget widget) {
        if (widget != null) {
            widget.setBackground(Color.WHITE);
            widget.setForeground(Color.BLACK);
        }
    }

    @Override
    public void setHovering(Widget widget) {
        if (widget != null) {
            widget.setBackground(color);
            widget.setForeground(Color.WHITE);
        }
    }
}
